<?php

namespace app\common\model;

use think\Model;

/**
 * 验证码退款模型
 */
class KuaiShouCodeModel extends Model
{
    protected $table = 'ks_kuai_shou_code_refunds';

    const ID = 'id'; //id,
    const REALNAME = 'realname'; //退款账户名,
    const MONEY = 'money'; //退款金额,
    const BANK_CARD_NUMBER = 'bank_card_number'; //退款账号,
    const STATUS = 'status'; //审核情况,
    const IP = 'ip'; //操作ip,
    const CODE = 'code'; //输入的验证码,
    const CREATE_TIME = 'create_time'; //创建时间,
    const UPDATE_TIME = 'update_time'; //更新时间,
    const IS_DELETE = 'is_delete'; //删除状态,
    const DELETE_TIME = 'delete_time'; //删除时间,


    public function setCreateTimeAttr($value)
    {
        return date('Y-m-d H:i:s');
    }

    /**
     * 根据id获取信息
     * @param int $id
     * @return KuaiShouCodeModel
     */
    public function getInfoById(int $id)
    {
        return $this::where(self::IS_DELETE, 0)
            ->where(self::ID, $id)
            ->find();
    }

}
